package com.yiqi.liebang.feature.mine.view.adapter;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.flyco.tablayout.CommonTabLayout;
import com.flyco.tablayout.listener.OnTabSelectListener;
import com.suozhang.framework.component.recyclerview.DividerItemDecoration;
import com.suozhang.framework.framework.AM;
import com.suozhang.framework.framework.Callback;
import com.suozhang.framework.utils.T;
import com.suozhang.framework.widget.EmptyTextView;
import com.yiqi.liebang.R;
import com.yiqi.liebang.common.widget.dialog.NormalDialog;
import com.yiqi.liebang.common.widget.dialog.OnBtnClickL;
import com.yiqi.liebang.entity.bo.UserCenterBo;
import com.yiqi.liebang.entity.enums.CertificationType;
import com.yiqi.liebang.feature.mine.view.CommentFriendActivity;
import com.yiqi.liebang.feature.mine.view.AddTopicActivity;
import com.yiqi.liebang.feature.mine.view.EditEducationActivity;
import com.yiqi.liebang.feature.mine.view.EditIntroduceActivity;
import com.yiqi.liebang.feature.mine.view.EditOtherActivity;
import com.yiqi.liebang.feature.mine.view.EditUserCardActivity;
import com.yiqi.liebang.feature.mine.view.EditWorkActivity;
import com.yiqi.liebang.feature.mine.view.EduWorkListActivity;
import com.yiqi.liebang.feature.mine.view.ExpertCertificationActivity;
import com.yiqi.liebang.feature.mine.view.OtherTopicListActivity;
import com.yiqi.liebang.feature.mine.view.TopicListDialog;
import com.yiqi.liebang.feature.mine.view.UserInfoActivity;
import com.yiqi.liebang.feature.order.view.OrderActivity;
import com.yiqi.liebang.feature.people.view.FriendsListActivity;
import com.yiqi.liebang.feature.people.view.PeopleActivity;
import com.yiqi.liebang.feature.setting.view.ServiceAgreementActivity;
import com.yiqi.liebang.framework.DataServer;

import java.util.List;

import static com.suozhang.framework.utils.DateUtil.formatTimeToState2;

public class UserInfoAdpter extends BaseMultiItemQuickAdapter<MultipleUserItem, BaseViewHolder> {
    private boolean isShow = false;
    private Activity mContext;
    UserCenterBo mData = null;
    Boolean flag = true;
    private boolean isLookMe = false;
    Callback.CommonCallback addUserClickListener;
    View.OnClickListener wxClickListener;

    public UserInfoAdpter(List<MultipleUserItem> data, boolean isShow, boolean isLookMe, Activity mContext, UserCenterBo s) {
        super(data);
        this.isShow = isShow;
        this.mContext = mContext;
        this.mData = s;
        this.isLookMe = isLookMe;
        addItemType(MultipleUserItem.ITEM_TOP, R.layout.layout_userinfo_top);
        addItemType(MultipleUserItem.ITEM_ASK, R.layout.layout_userinfo_ask);
        addItemType(MultipleUserItem.ITEM_ZWJS, R.layout.layout_userinfo_zwjs);
        addItemType(MultipleUserItem.ITEM_GZJL, R.layout.layout_userinfo_gzjl);
        addItemType(MultipleUserItem.ITEM_JYJL, R.layout.layout_userinfo_jyjl);
        addItemType(MultipleUserItem.ITEM_GDZL, R.layout.layout_userinfo_gdzl);
        addItemType(MultipleUserItem.ITEM_ZYBQ, R.layout.layout_userinfo_zybq);
        addItemType(MultipleUserItem.ITEM_PINGLUN, R.layout.layout_userinfo_hydp);
        addItemType(MultipleUserItem.ITEM_HYTJ, R.layout.layout_userinfo_hytj);
        addItemType(MultipleUserItem.ITEM_FFXZ, R.layout.layout_userinfo_ffxz);
    }

    @Override
    protected void convert(BaseViewHolder helper, MultipleUserItem item) {
        switch (helper.getItemViewType()) {
            case MultipleUserItem.ITEM_TOP:

                if (isShow && isLookMe) {
                    helper.getView(R.id.btn_userinfo_top_edit).setVisibility(View.VISIBLE);
                    helper.getView(R.id.btn_share).setVisibility(View.GONE);
                    helper.getView(R.id.btn_complete).setVisibility(View.VISIBLE);
                } else {
                    helper.getView(R.id.btn_userinfo_top_edit).setVisibility(View.GONE);
                    helper.getView(R.id.btn_share).setVisibility(View.VISIBLE);
                    helper.getView(R.id.btn_complete).setVisibility(View.GONE);
                }
                if (isShow && mData.getIsBasic() == 0 && isLookMe) {
                    helper.getView(R.id.btn_userinfo_top_renzheng).setVisibility(View.VISIBLE);
                } else {
                    helper.getView(R.id.btn_userinfo_top_renzheng).setVisibility(View.GONE);
                }

                if (!isLookMe && mData.getPhonePrivacy() == 0) {
                    helper.getView(R.id.tv_user_phone).setVisibility(View.GONE);
                } else {
                    helper.getView(R.id.tv_user_phone).setVisibility(View.VISIBLE);
                }
                AM.image().bindToCircleObject(mData.getUserHead(), helper.getView(R.id.iv_user_head));
                AM.image().bindToCircleObject(mData.getComLogo(), helper.getView(R.id.iv_user_company));
                helper
                        .setVisible(R.id.iv_user_position, mData.getIsOccupation() == 1 ? true : false)
                        .setVisible(R.id.iv_user_certification, mData.getIsBasic() == 1 ? true : false)
                        .setText(R.id.tv_visitor_name, TextUtils.isEmpty(mData.getUserName()) ? "未编辑" : mData.getUserName())
                        .setText(R.id.tv_visitor_position, TextUtils.isEmpty(mData.getPosition()) ? "暂无认证职位" : mData.getCompany() + mData.getPosition())
                        .setText(R.id.tv_user_industry, (TextUtils.isEmpty(mData.getUserIndustry()) ? "暂无行业" : mData.getUserIndustry())
                                + " | " + (mData.getUserClassify() != null && mData.getUserClassify().size() > 0
                                ? DataServer.getClassfiyStr(mData.getUserClassify()) : "暂无标签") +
                                " | 影响力\t" + (mData.getEffectScore()))
                        .setText(R.id.tv_user_mail, TextUtils.isEmpty(mData.getUserEmail()) ? "未编辑" : mData.getUserEmail())
                        .setText(R.id.tv_user_phone, TextUtils.isEmpty(mData.getPhone()) ? "未编辑" : mData.getPhone())
                        .setText(R.id.tv_user_address, (TextUtils.isEmpty(mData.getUserWorkAddress()) ? "未编辑" : mData.getUserWorkAddress()) + (TextUtils.isEmpty(mData.getUserDetailAddress()) ? "" : mData.getUserDetailAddress()))
                        .setText(R.id.tv_user_like_count, Html.fromHtml("<font color=\"#2AA0F8\">" + mData.getLikeNum() + "</font>" + "人喜欢\t\t帮助过<font color=\"#2AA0F8\">" + mData.getHelpNum() + "</font>人"))
                ;


                helper.getView(R.id.btn_share).setOnClickListener(wxClickListener);
                helper.getView(R.id.btn_complete).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mContext.finish();
                    }
                });
                CommonTabLayout mTl1 = helper.getView(R.id.tl_1);
                mTl1.setTabData(isLookMe ? DataServer.getTabEntity() : DataServer.getTabEntityOther());
                mTl1.setOnTabSelectListener(new OnTabSelectListener() {
                    @Override
                    public void onTabSelect(int position) {
                        Intent intent = null;
                        switch (position) {
                            case 0:
                                if (mData.getIsBasic() == 1 || mData.getIsOccupation() == 1 || mData.getIsEducation() == 1 || mData.getMechanism() == 1) {
                                    if (mData.getTopic()!=null&&mData.getTopic().size()>0){
                                        TopicListDialog topicListDialog = new TopicListDialog(mContext, mData.getTopic(), isLookMe,mData.getUserUid());
                                        topicListDialog.show();
                                    }else {
                                        showDialog("该用户没有话题商品");
                                    }
                                }else {
                                    showDialog(isLookMe?"您目前还不是行家":"TA目前还不是行家");
                                }
                                break;
                            case 1:
                                intent = new Intent(mContext, OtherTopicListActivity.class);
                                intent.putExtra("id", mData.getUserUid());
                                intent.putExtra("type", isLookMe ? "0" : "1");
                                break;
                            case 2:

                                intent = new Intent(mContext, FriendsListActivity.class);
                                intent.putExtra("user_id", isLookMe ? null : mData.getUserUid());

                                break;
                            case 3:
                                intent = new Intent(mContext, OrderActivity.class);
                                break;

                        }
                        mContext.startActivity(intent);
                    }

                    @Override
                    public void onTabReselect(int position) {
                        Intent intent = null;
                        switch (position) {
                            case 0:
                                if (mData.getIsBasic() == 1 || mData.getIsOccupation() == 1 || mData.getIsEducation() == 1 || mData.getMechanism() == 1) {
                                       if (mData.getTopic()!=null&&mData.getTopic().size()>0){
                                           TopicListDialog topicListDialog = new TopicListDialog(mContext, mData.getTopic(), isLookMe,mData.getUserUid());
                                           topicListDialog.show();
                                       }else {
                                           showDialog("该用户没有话题商品");
                                       }
                                }else {
                                    showDialog(isLookMe?"您目前还不是行家":"TA目前还不是行家");
                                }

                                break;
                            case 1:
                                intent = new Intent(mContext, OtherTopicListActivity.class);
                                intent.putExtra("id", mData.getUserUid());
                                mContext.startActivity(intent);
                                break;
                            case 2:

                                intent = new Intent(mContext, FriendsListActivity.class);
                                intent.putExtra("user_id", isLookMe ? null : mData.getUserUid());
                                mContext.startActivity(intent);
                                break;
                            case 3:
                                intent = new Intent(mContext, OrderActivity.class);
                                mContext.startActivity(intent);
                                break;

                        }


                    }
                });
                helper.getView(R.id.btn_back).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mContext.finish();
                    }
                });

                helper.getView(R.id.btn_userinfo_top_edit).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mContext.startActivity(new Intent(mContext, EditUserCardActivity.class));
                    }
                });

                helper.getView(R.id.btn_userinfo_top_renzheng).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(mContext, ExpertCertificationActivity.class);
                        intent.putExtra("type", CertificationType.BASIC.getIndex());
                        mContext.startActivity(intent);
                    }
                });

                if (mData.getUserStatus() == 1) {
                    mTl1.setVisibility(View.GONE);
                    helper.getView(R.id.tv_user_like_count).setVisibility(View.GONE);
                    helper.getView(R.id.view_bottom_line).setVisibility(View.GONE);
                    helper.getView(R.id.tv_user_fjing).setVisibility(View.VISIBLE);
                } else {
                    helper.getView(R.id.tv_user_fjing).setVisibility(View.GONE);
                }


                break;
            case MultipleUserItem.ITEM_ASK:
                if (isLookMe) {
                    if (mData.getIsBasic() == 1 || mData.getIsOccupation() == 1 || mData.getIsEducation() == 1 || mData.getMechanism() == 1) {
                        helper.getView(R.id.btn_userinfo_zwjs_add).setVisibility(View.VISIBLE);
                    } else {
                        helper.getView(R.id.btn_userinfo_zwjs_add).setVisibility(View.GONE);
                    }
                } else {
                    helper.getView(R.id.btn_userinfo_zwjs_add).setVisibility(View.GONE);
                }
                helper.getView(R.id.btn_userinfo_zwjs_add).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (mData.getIsBasic() == 1 || mData.getIsOccupation() == 1 || mData.getIsEducation() == 1 || mData.getMechanism() == 1) {
                            Intent intent = new Intent(mContext, AddTopicActivity.class);
                            intent.putExtra("is_add", true);
                            mContext.startActivity(intent);
                        } else {
                            T.showShort("您还未认证基本信息！");
                        }
                    }
                });


                RecyclerView mRvQuestion = helper.getView(R.id.rv_ask);
                EmptyTextView emptyView = new EmptyTextView(mRvQuestion);
                TopicAdapter mAdapter = new TopicAdapter(isShow, isLookMe);
                mRvQuestion.setLayoutManager(new LinearLayoutManager(AM.app()));
                mRvQuestion.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.VERTICAL).setHeight(2));
                mAdapter.bindToRecyclerView(mRvQuestion);

                if (mData.getTopic() != null&&mData.getTopic().size() > 0) {
                    if (mData.getTopic().size() > 3) {
                        helper.getView(R.id.view_show_topic).setVisibility(View.VISIBLE);
                        List<UserCenterBo.TopicBean> topicBeans = mData.getTopic().subList(0, 3);
                        mAdapter.setNewData(topicBeans);
                    } else {
                        helper.getView(R.id.view_show_topic).setVisibility(View.VISIBLE);
                        mAdapter.setNewData(mData.getTopic());
                    }
                }else {
//                    mAdapter.setEmptyView(emptyView.getEmptyView("暂无发表话题"));
                    helper.getView(R.id.view_show_topic).setVisibility(View.GONE);
                }


                mAdapter.setOnItemClickListener(new OnItemClickListener() {
                    @Override
                    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                        if (mData.getIsBasic() == 1 || mData.getIsOccupation() == 1 || mData.getIsEducation() == 1 || mData.getMechanism() == 1) {
                            if (mData.getTopic()!=null&&mData.getTopic().size()>0){
                                TopicListDialog topicListDialog = new TopicListDialog(mContext, mData.getTopic(), isLookMe,mData.getUserUid());
                                topicListDialog.show();
                            }else {
                                showDialog("该用户没有话题商品");
                            }
                        }else {
                            showDialog(isLookMe?"您目前还不是行家":"该用户没有话题商品");
                        }
                    }
                });

                break;

            case MultipleUserItem.ITEM_ZWJS:

                TextView tvIntroduce = helper.getView(R.id.tv_user_intro);
                TextView btnIntroduce = helper.getView(R.id.btn_user_intro);
                helper.setVisible(R.id.btn_userinfo_zwjs_edit, isShow && isLookMe)
                        .setText(R.id.tv_user_intro, TextUtils.isEmpty(mData.getUserIntroduce()) ? "该用户暂无编辑自我介绍" : mData.getUserIntroduce());
                helper.getView(R.id.btn_userinfo_zwjs_edit).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(mContext, EditIntroduceActivity.class);
                        intent.putExtra("info", mData.getUserIntroduce());
                        mContext.startActivity(intent);
                    }
                });

                tvIntroduce.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
                    @Override
                    public boolean onPreDraw() {
                        int lineCount = tvIntroduce.getLineCount();
                        if (lineCount > 3) {
                            btnIntroduce.setVisibility(View.VISIBLE);
                        } else {
                            btnIntroduce.setVisibility(View.GONE);
                        }
                        tvIntroduce.getViewTreeObserver().removeOnPreDrawListener(this);
                        return false;
                    }
                });
                helper.getView(R.id.btn_user_intro).setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        if (flag) {
                            flag = false;
                            tvIntroduce.setEllipsize(null); // 展开
                            tvIntroduce.setSingleLine(flag);
                            btnIntroduce.setText("收起全部");
                        } else {
                            flag = true;
                            tvIntroduce.setEllipsize(TextUtils.TruncateAt.END); // 收缩
                            tvIntroduce.setMaxLines(3);
                            btnIntroduce.setText("展开查看更多");
                        }
                    }
                });

                break;
            case MultipleUserItem.ITEM_GZJL:
                helper.setVisible(R.id.btn_userinfo_gzjl_add, isShow && isLookMe);
                helper.getView(R.id.btn_userinfo_gzjl_add).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intents = new Intent(mContext, EditWorkActivity.class);
                        intents.putExtra("isAdd", true);
                        mContext.startActivity(intents);
                    }
                });
                RecyclerView mRvWork = helper.getView(R.id.rv_gzjl);
                EmptyTextView emptyViewWork = new EmptyTextView(mRvWork);
                WorkAdapter workAdapter = new WorkAdapter(isShow, isLookMe);
                mRvWork.setLayoutManager(new LinearLayoutManager(AM.app()));
                mRvWork.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.VERTICAL).setHeight(2));
                workAdapter.bindToRecyclerView(mRvWork);

                if (mData.getOccupationAuthentication() != null && mData.getOccupationAuthentication().size() > 0) {
                    workAdapter.setNewData(mData.getOccupationAuthentication());
                } else {
                    workAdapter.setEmptyView(emptyViewWork.getEmptyView("该用户暂无添加工作经历"));
                    workAdapter.setNewData(null);
                }
                workAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
                    @Override
                    public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
                        switch (view.getId()) {
                            case R.id.btn_userinfo_work_edit:
                                Intent intents = new Intent(mContext, EditWorkActivity.class);
                                intents.putExtra("isAdd", false);
                                intents.putExtra("id", workAdapter.getData().get(position).getId());
                                intents.putExtra("sign", position);
                                mContext.startActivity(intents);
                                break;
                            case R.id.btn_userinfo_work_renzheng:
                                Intent intent = new Intent(mContext, ExpertCertificationActivity.class);
                                intent.putExtra("work_id", workAdapter.getData().get(position).getId());
                                intent.putExtra("type", CertificationType.ZHIYE.getIndex());
                                mContext.startActivity(intent);
                                break;
                        }
                    }
                });

                workAdapter.setOnItemClickListener(new OnItemClickListener() {
                    @Override
                    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                        Intent intent = new Intent(mContext, EduWorkListActivity.class);
                        intent.putExtra("info", mData);
                        mContext.startActivity(intent);
                    }
                });
                break;
            case MultipleUserItem.ITEM_JYJL:
                helper.setVisible(R.id.btn_userinfo_jyjl_add, isShow && isLookMe);

                helper.getView(R.id.btn_userinfo_jyjl_add).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intents = new Intent(mContext, EditEducationActivity.class);
                        intents.putExtra("isAdd", true);
                        mContext.startActivity(intents);
                    }
                });

                RecyclerView mRvJy = helper.getView(R.id.rv_jyjl);
                EmptyTextView emptyViewJy = new EmptyTextView(mRvJy);
                EducationAdapter jyAdapter = new EducationAdapter(isShow, isLookMe);
                mRvJy.setLayoutManager(new LinearLayoutManager(AM.app()));
                mRvJy.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.VERTICAL).setHeight(3));
                jyAdapter.bindToRecyclerView(mRvJy);
                if (mData.getEducationAuthentication() != null && mData.getEducationAuthentication().size() > 0) {
                    jyAdapter.setNewData(mData.getEducationAuthentication());
                } else {
                    jyAdapter.setEmptyView(emptyViewJy.getEmptyView("该用户暂无添加教育经历"));
                    jyAdapter.setNewData(null);
                }

                jyAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
                    @Override
                    public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
                        switch (view.getId()) {
                            case R.id.btn_userinfo_education_edit:
                                String id = jyAdapter.getData().get(position).getId();
                                Intent intents = new Intent(mContext, EditEducationActivity.class);
                                intents.putExtra("isAdd", false);
                                intents.putExtra("id", id);
                                intents.putExtra("sign", position);
                                mContext.startActivity(intents);
                                break;
                            case R.id.btn_userinfo_education_renzheng:
                                Intent intent = new Intent(mContext, ExpertCertificationActivity.class);
                                intent.putExtra("edu_id", jyAdapter.getData().get(position).getId());
                                intent.putExtra("type", CertificationType.JAOYU.getIndex());
                                mContext.startActivity(intent);
                                break;
                        }
                    }
                });

                jyAdapter.setOnItemClickListener(new OnItemClickListener() {
                    @Override
                    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                        Intent intent = new Intent(mContext, EduWorkListActivity.class);
                        intent.putExtra("info", mData);
                        mContext.startActivity(intent);
                    }
                });
                break;
            case MultipleUserItem.ITEM_GDZL:

                helper.setVisible(R.id.btn_userinfo_gdzl_edit, isShow && isLookMe)
                        .setText(R.id.tv_user_hometown, TextUtils.isEmpty(mData.getUserHometown()) ? "未编辑" : mData.getUserHometown())
                        .setText(R.id.tv_user_bithday, TextUtils.isEmpty(mData.getUserBirth()) ? "未编辑" : formatTimeToState2(mData.getUserBirth()));

                helper.getView(R.id.btn_userinfo_gdzl_edit).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(mContext, EditOtherActivity.class);
                        intent.putExtra("home", mData.getUserHometown());
                        intent.putExtra("bith", mData.getUserBirth());
                        mContext.startActivity(intent);
                    }
                });
                break;
            case MultipleUserItem.ITEM_ZYBQ:
                RecyclerView mRvZY = helper.getView(R.id.rv_zybq);
                EmptyTextView emptyViewLabel = new EmptyTextView(mRvZY);
                ProfessionalAdapter professionalAdapter = new ProfessionalAdapter(mData.getUserHead(), isLookMe,mData.getIsComment());
                mRvZY.setLayoutManager(new LinearLayoutManager(AM.app()));
                mRvZY.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.VERTICAL).setHeight(3));
                professionalAdapter.bindToRecyclerView(mRvZY);

                if (mData.getUserClassify() != null && mData.getUserClassify().size() > 0) {
                    professionalAdapter.setNewData(mData.getUserClassify());
                } else {
                    professionalAdapter.setEmptyView(emptyViewLabel.getEmptyView("该用户暂无添加教育经历"));
                    professionalAdapter.setNewData(null);
                }
                professionalAdapter.setNewData(mData.getUserClassify());
                break;
            case MultipleUserItem.ITEM_PINGLUN:
                if (isLookMe) {
                    helper.getView(R.id.view_comment).setVisibility(View.GONE);
                } else {
                    helper.getView(R.id.view_comment).setVisibility(View.VISIBLE);
                }
                helper.setText(R.id.tv_connment_name, "我要点评" + mData.getUserName());

                helper.getView(R.id.tv_connment_name).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (mData.getIsComment() == 1) {
                            Intent intent = new Intent(mContext, CommentFriendActivity.class);
                            intent.putExtra("userUid", mData.getUserUid());
                            intent.putExtra("userName", mData.getUserName());
                            mContext.startActivity(intent);
                        } else {
                            final NormalDialog dialog = new NormalDialog(mContext);
                            dialog.content("您暂无权限评论该用户！")//
                                    .btnNum(1)
                                    .btnText("取消")//
                                    .show();

                            dialog.setOnBtnClickL(new OnBtnClickL() {
                                @Override
                                public void onBtnClick() {
                                    dialog.dismiss();
                                }
                            });
                        }
                    }
                });


                RecyclerView mRvDP = helper.getView(R.id.rv_hydp);
                EmptyTextView emptyTextView = new EmptyTextView(mRvDP);
                CommentsAdapter commentsAdapter = new CommentsAdapter(isLookMe, mData.getIsComment());
                commentsAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
                mRvDP.setLayoutManager(new LinearLayoutManager(AM.app()));
                mRvDP.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.VERTICAL).setHeight(3));
                commentsAdapter.bindToRecyclerView(mRvDP);

                if (mData.getComment() != null) {
                    if (mData.getComment().size() == 0) {
//                        commentsAdapter.setEmptyView(emptyTextView.getEmptyView("暂无人评论过" + mData.getUserName()));
                        commentsAdapter.setNewData(null);
                    } else if (mData.getComment().size() > 3) {
                        List<UserCenterBo.CommentBean> topicBeans = mData.getComment().subList(0, 3);
                        commentsAdapter.setNewData(topicBeans);
                    } else if (mData.getComment().size() <= 3) {
                        commentsAdapter.setNewData(mData.getComment());
                    }
                } else {
//                    commentsAdapter.setEmptyView(emptyTextView.getEmptyView("暂无人评论过" + mData.getUserName()));
                    commentsAdapter.setNewData(null);
                }

                helper.setGone(R.id.btn_comment_all, (mData.getComment() != null && mData.getComment().size() > 3) ? true : false)
                        .setText(R.id.btn_comment_all, "全部" + mData.getComment().size() + "个点评")
                        .setText(R.id.tv_user_comment_count, mData.getComment() != null ? "共" + mData.getComment().size() + "人点评过" + mData.getUserName() : "");
                helper.getView(R.id.btn_comment_all).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        commentsAdapter.setNewData(null);
                        commentsAdapter.setNewData(mData.getComment());
                        helper.getView(R.id.btn_comment_all).setVisibility(View.GONE);
                    }
                });

                commentsAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
                    @Override
                    public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
                         Intent intents = new Intent(mContext, UserInfoActivity.class);
                        intents.putExtra("is_view_my", false);
                        intents.putExtra("visitorUid", commentsAdapter.getData().get(position).getUserUid());
                        mContext.startActivity(intents);
                    }
                });
                break;
            case MultipleUserItem.ITEM_HYTJ:
                RecyclerView mRvFriend = helper.getView(R.id.rv_hytj);
                EmptyTextView emptyTextView1 = new EmptyTextView(mRvFriend);
                FriendsAdapter friendsAdapter = new FriendsAdapter();
                mRvFriend.setLayoutManager(new LinearLayoutManager(AM.app()));
                mRvFriend.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.VERTICAL).setHeight(3));
                friendsAdapter.bindToRecyclerView(mRvFriend);
                if (mData != null && mData.getUserFriend().size() > 0) {
                    friendsAdapter.setNewData(mData.getUserFriend());
                } else {
                    friendsAdapter.setEmptyView(emptyTextView1.getEmptyView("暂无推荐好友"));
                    friendsAdapter.setNewData(null);
                }
                friendsAdapter.setOnItemClickListener(new OnItemClickListener() {
                    @Override
                    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                        Intent intent = new Intent(mContext, UserInfoActivity.class);
                        intent.putExtra("is_view_my", false);
                        intent.putExtra("visitorUid", friendsAdapter.getData().get(position).getUserUid());
                        mContext.startActivity(intent);
                    }
                });
                friendsAdapter.setCommonCallback(addUserClickListener);
                helper.getView(R.id.btn_more_tj).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mContext.startActivity(new Intent(mContext, PeopleActivity.class));
                    }
                });

                break;
            case MultipleUserItem.ITEM_FFXZ:

                TextView textView = helper.getView(R.id.tv_help_xy);
                final SpannableStringBuilder style = new SpannableStringBuilder();

                //设置文字
                style.append("1.选择预约行家，付款后，等待72小时内行家确认见面的时间地点或通话的时间安排。" +
                        "" +
                        "\n2.学员可通过私聊方式与行家沟通见面或通话细节。\n3.虚拟商品原则上不予退款，如有争议，参见猎帮用户协议。" +
                        "\n4.七个工作日内如行家未能确认服务完成，系统将自动退款至学员付款原账户。" +
                        "\n5.如有任何问题，可拨打客服电话:0755-86906070,工作日09:00-18:00");

                //设置部分文字点击事件
                ClickableSpan clickableSpan = new ClickableSpan() {
                    @Override
                    public void onClick(View widget) {
                        mContext.startActivity(new Intent(mContext, ServiceAgreementActivity.class));
                    }
                };
                style.setSpan(clickableSpan, 87, 93, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                textView.setText(style);

                //设置部分文字颜色
                ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(Color.parseColor("#2aa0f8"));
                style.setSpan(foregroundColorSpan, 87, 93, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

                //配置给TextView
                textView.setMovementMethod(LinkMovementMethod.getInstance());
                textView.setText(style);

                break;
        }

    }


    public void setAddUserClickListener(Callback.CommonCallback addUserClickListener) {
        this.addUserClickListener = addUserClickListener;
    }

    public void setWxClickListener(View.OnClickListener wxClickListener) {
        this.wxClickListener = wxClickListener;
    }


    public  void showDialog(String msg){
        final NormalDialog dialog = new NormalDialog(mContext);
        dialog.content(msg)//
                .btnNum(1)
                .btnText("取消")//
                .show();

        dialog.setOnBtnClickL(new OnBtnClickL() {
            @Override
            public void onBtnClick() {
                dialog.dismiss();
            }
        });
    }

}
